package com.demo.Service;

import com.demo.mapper.SeataMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class accountService {
    @Resource
    SeataMapper seataMapper;

    @GlobalTransactional
    @Transactional(rollbackFor = Exception.class)
    public String insert_account(){
        seataMapper.insert_account();
        throw new RuntimeException("异常:模拟业务异常:stock branch exception");
    }
}
